package cn.edu.dutir.utility;

import java.util.Comparator;

/**
 * The <code>Scored</code> interface should be implemented by objects
 * that return a double-valued score.  There is a simple score
 * comparator, and scored objects are the natural wrappers of other
 * objects in priority queues.
 * 
 */
public interface Scored {

    /**
     * Returns the score for this object.  
     *
     * @return The score for this object.
     */
	public double score();

	
    /**
     * A comparator that compares scored objects by their score.  Note
     * that this comparator may not be consistent with natural
     * equality on a scored object which may depend on factors in
     * addition to the score.  This comparator may be used as the
     * priority ordering for a priority queue of objects sorted by
     * score.  It may also be passed to {@link
     * java.util.Arrays#sort(Object[],Comparator)}.
     */
	public static final Comparator<Scored> SCORED_COMPARATOR 
				= new ScoredObject.ScoredComparator();

    /**
     * A comparator that orders scored objects in reverse score order.
     * Thus it returns the negative value of that returned by {@link
     * #SCORE_COMPARATOR}, and like that ordering, is not consistent
     * with object equality.  This comparator is useful for priority
     * queues.
     */
	public static final Comparator<Scored> REVERSE_SCORED_COMPARATOR 
				= new ScoredObject.ReverseScoredComparator();
}
